﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Web.Mvc;
namespace RBAC.Web.Models
{
    public class PermissionModel : BaseModel
    {

        //Autokey NOT PK
        [DisplayName("Id")]
        public int Id { get; set; }

        //Pk NOT Autokey
        [Required]
        [StringLength(255, ErrorMessage = "PermissionName cannot be longer than 255 characters.")]
        [Remote("doesPermissionNameExist", "Permission", HttpMethod = "POST", AdditionalFields = "Mode, OldValue", ErrorMessage = "Permission Name already exists. Please enter a different Permission Name")]
        [DisplayName("Permission Name")]
        public String PermissionName { get; set; }


        [Required]
        [StringLength(255, ErrorMessage = "Description cannot be longer than 255 characters.")]
        [DisplayName("Description")]
        public String Description { get; set; }


        //[Required]
        //[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
        //[DisplayName("Create Date")]
        //public DateTime CreateDate { get; set; }

        [DisplayName("Role")]
        public int Role { get; set; }
        public int RoleId { get; set; }
        public String RoleRoleCode { get; set; }

        [DisplayName("Function")]
        public int Function { get; set; }
        public int FunctionId { get; set; }
        public String FunctionFuncName { get; set; }


        [Required(ErrorMessage = "Please select PermissionStatus")]
        [DisplayName("Status")]
        public int PermissionStatus { get; set; }


        [DisplayName("Role")]
        public int RoleLookup { get; set; }
        public int RoleLookupId { get; set; }
        public String RoleLookupRoleCode { get; set; }

        // For PopLookup
        public List<PermissionModel> ListOfPermission { get; set; }
        public string[] RequiredFields { get; set; }
    }
}